/**
 * 
 */
package test;

import java.math.BigDecimal;
import java.rmi.RemoteException;

import org.apache.axis2.AxisFault;
import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;

import com.michelin.crm.mars.CRM2MARSStub;

/**
 * @author YIFEGU
 *
 */
public class CRM2MARSWebService {

    /**
     * @param args
     * @throws RemoteException 
     */
    public static void main(String[] args) throws RemoteException {
        String url = "http://marsns.chinacloudapp.cn:9022/MARSR5/WS/MARS%20W1%20ERM%20Dealer%201/Codeunit/CRM2MARS?tenant=r5dealer1";
        CRM2MARSStub stub = new CRM2MARSStub(url);
        Options options = stub._getServiceClient().getOptions();
        HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
        auth.setPreemptiveAuthentication(true);
        auth.setUsername("r5dealer1\\alan");
        auth.setPassword("Michelin01");
        options.setProperty(HTTPConstants.AUTHENTICATE,auth);
        CRM2MARSStub.InsertSalesLine insertSalesLine = new CRM2MARSStub.InsertSalesLine();
        insertSalesLine.setPrice(new BigDecimal("100.00"));
        insertSalesLine.setQuantity(new BigDecimal("10.00"));
        insertSalesLine.setDescription("一次换油服务");
        stub.insertSalesLine(insertSalesLine);
    }

}
